unit system;

interface

type
 TResult = Longint;
 
 Integer = longint;

const
 R_OK: TResult = 1;
 R_ERROR: TResult = 0;
 
 MaxInt = high(longint);
 MaxUInt = high(longword);

{$i BaseTypes.inc}
{$i systemh.inc}

{$i baseh.inc}
{$i pcharh.inc}
{$i atomich.inc}

{$i memh.inc}
{$i outputh.inc}
{$i int64h.inc}
{$i objecth.inc}
{$i setjumph.inc}

{$i excepth.inc}

implementation

var
{ Exit Procedure handling consts and types  }
  Erroraddr: pointer = nil;
  Errorcode: Word    = 0;
  
  StackBottom : Pointer = nil;
  StackLength : SizeUInt = 0;

Procedure HandleError (Errno : Longint);[public,alias : 'FPC_HANDLEERROR'];
begin
   Writeln('Kernel error!!! Code: ', errno);
   while true do;
end;

Procedure HandleErrorFrame (Errno : longint;frame : Pointer);
begin
   Writeln('Kernel error(with frame)!!! Code: ', errno);
   while true do;
end;

Procedure RunError(w:Word);
begin
   Writeln('Kernel runtime error!!! Code: ', w);
   while true do;
end;

Procedure halt(code: longint);
begin

end;

Procedure fpc_assert(Const Msg,FName:Shortstring;LineNo:Longint;ErrorAddr:Pointer); [Public,Alias : 'FPC_ASSERT']; compilerproc;
begin
   writeln('Assertation failed: "', msg, '". At line ', lineno, ' in "',fname,'"');
   while true do;
end;

procedure fpc_AbstractErrorIntern;compilerproc;[public,alias : 'FPC_ABSTRACTERROR'];
begin
end;

{$i system.inc}
{$i init.inc}

{$i pchar.inc}
{$i atomic.inc}
{$i base.inc}

{$i mem.inc}
{$i output.inc}
{$i int64.inc}
{$i object.inc}
{$i setjump.inc}

{$i except.inc}

begin
   SysInitExceptions;
end.
